home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #11 / Amiga Plus CD - 2004 - No. 11.iso / AmiSoft / Game / board / Saga.lha / Saga / source / saga.h < prev    next >
C/C++ Source or Header  |  2004-09-01  |  9KB  |  304 lines

  1. /* 1. KEYWORDS -----------------------------------------------------------
  2.  
  3. Defined by AmigaOS are: IMPORT, UBYTE, UWORD, ULONG.
  4.  
  5. AGLOBAL is deprecated; use EXPORT. */
  6.  
  7. #define AUTO         auto    /* automatic (function-scope) */
  8. #define AGLOBAL              /* global (project-scope) */
  9. #define EXPORT               /* global (project-scope) */
  10. #define MODULE       static  /* external static (file-scope) */
  11. #define PERSIST      static  /* internal static (function-scope) */
  12. typedef signed char  FLAG;   /* 8-bit signed quantity (replaces BOOL) */
  13. typedef signed char  SBYTE;  /* 8-bit signed quantity (replaces Amiga BYTE) */
  14. typedef signed short SWORD;  /* 16-bit signed quantity (replaces Amiga WORD) */
  15. typedef signed long  SLONG;  /* 32-bit signed quantity (same as LONG) */
  16. #define elif         else if
  17. #define acase        break; case
  18. #define adefault     break; default
  19.  
  20. // 2. DEFINES ------------------------------------------------------------
  21.  
  22. #ifdef __STORM__
  23.     #define EXIT_SUCCESS  0
  24.     #define EXIT_FAILURE 20
  25. #endif
  26.  
  27. #define LEFTSIDE          0
  28. #define RIGHTSIDE         1
  29. #define MAXLINES         47
  30.  
  31. #define NONE              0
  32. #define HUMAN             1
  33. #define AMIGA             2
  34.  
  35. #define AMSIR             0
  36. #define EON               1
  37. #define GEOFU             2
  38. #define ING               3
  39. #define OGAL              4
  40. #define SYGIL             5
  41.  
  42. #define LAND              0
  43. #define SEA               1
  44. #define ISLE              2
  45. #define PENINSULA         3
  46.  
  47. #define BALMUNG           0
  48. #define DRAGVENDILL       1
  49. #define GRAM              2
  50. #define HRUNTING          3
  51. #define LOVI              4
  52. #define TYRFING           5
  53.  
  54. #define TURNS            20
  55.  
  56. #define RUNES             5
  57.  
  58. #define BROSUNGNECKLACE  0
  59. #define FREYFAXI         1
  60. #define MAGICSHIRT       2
  61. #define MAILCOAT         3
  62. #define HEALINGPOTION    4
  63. #define TELEPORTSCROLL   5
  64.  
  65. #define BEOWULF          0
  66. #define BRUNHILD         1
  67. #define EGIL             2
  68. #define RAGNAR           3
  69. #define SIEGFRIED        4
  70. #define STARKAD          5
  71.  
  72. #define MULTIKEYBOARD    0
  73. #define COUNTRY          1
  74. #define COUNTER          2
  75. #define ANYKEY           3
  76. #define YNKEYBOARD       4
  77. #define GLKEYBOARD       5
  78. #define WRKEYBOARD       6
  79.  
  80. #define ONEKEY_YES       0
  81. #define ONEKEY_NO        1
  82. #define ONEKEY_WITHDRAW  2
  83. #define ONEKEY_RESTART   3
  84. #define ONEKEY_TRANSFER  4
  85. #define ONEKEY_GLORY     5
  86. #define ONEKEY_LUCK      6
  87. #define ONEKEYS          ONEKEY_LUCK
  88.  
  89. #define FREY             0
  90. #define LOKI             1
  91. #define NJORD            2
  92. #define ODIN             3
  93. #define THOR             4
  94. #define TYR              5
  95.  
  96. #define UPPER            0
  97. #define LOWER            1
  98.  
  99. #define COUNTERWIDTH     2 // in words (24 pixels, rounded up)
  100. #define COUNTERHEIGHT   24 // in pixels
  101. #define MINDEPTH         7 // in bitplanes
  102. #define DEPTH            8 // in bitplanes
  103. #define CONNECTIONS      7
  104. #define TBSIZE          11
  105.  
  106. // double buffering subsystem
  107. #define OK_REDRAW         1
  108. #define OK_SWAPIN         2
  109.  
  110. // types of things
  111. #define HERO              0
  112. #define JARL              1
  113. #define MONSTER           2
  114. #define TREASURE          3
  115. #define SORD              4
  116. #define KINGDOM           5
  117.  
  118. // quantities of things, counting from 0
  119. #define HEROES            5
  120. #define JARLS            17
  121. #define MONSTERS         30
  122. #define SORDS             5
  123. #define TREASURES         5
  124.  
  125. #define BLACK             0
  126. #define WHITE             1
  127. #define LIGHTGREY         2
  128. #define MEDIUMGREY        3
  129. #define DARKGREY          4
  130. #define GREEN             5
  131. #define BLUE              6
  132. #define ORANGE           86
  133. #define PURPLE           87
  134. #define RED              88
  135.  
  136. #define FACEUP            0
  137. #define FACEDOWN          1
  138.  
  139. #define SCREENXPIXEL    640
  140. #define SCREENYPIXEL    512
  141. #define ABOUTXPIXEL     312
  142. #define ABOUTYPIXEL      76
  143.  
  144. #define SLOTS      (HEROES + 1 + JARLS + 1 + MONSTERS + 1 + TREASURES + 1 + SORDS + 1 - 1)
  145. #define ATTACKS    (HEROES + 1 + JARLS + 1 + MONSTERS + 1 + 36)
  146.  
  147. // 3. GLOBAL FUNCTIONS ---------------------------------------------------
  148.  
  149. // from system.c
  150. AGLOBAL void cleanexit(SLONG rc);
  151. AGLOBAL void screenoff(void);
  152. AGLOBAL void screenon(void);
  153. AGLOBAL void darken(void);
  154. AGLOBAL void say(SLONG position);
  155. AGLOBAL void hint(STRPTR thehint1, STRPTR thehint2);
  156. AGLOBAL SLONG getevent(SLONG mode, SLONG* countertype);
  157.  
  158. #ifdef __STORM__
  159.     EXPORT int stcl_d(char* out, long lvalue);
  160. #endif
  161.  
  162. EXPORT void drawmap(void);
  163. EXPORT void drawmap2(void);
  164. EXPORT void drawmap3(void);
  165. EXPORT void drawmap4(void);
  166.  
  167. // from gfx.c
  168. AGLOBAL void drawabout(void);
  169. AGLOBAL void drawlogo(void);
  170. AGLOBAL void boingball(void);
  171. AGLOBAL void unboingball(void);
  172. AGLOBAL void preboingball(void);
  173. AGLOBAL void DrawGels(void);
  174. AGLOBAL WORD bounceORoutine(struct AnimOb *anOb);
  175. /* This is an oroutine so parameters are fixed;
  176. it needs global exposure as it is called directly by AmigaDOS. */
  177. EXPORT void clearscreen(void);
  178. EXPORT void fillwindow(struct Window* WindowPtr);
  179.  
  180. // from engine.c
  181. AGLOBAL void place_monsters(void);
  182. AGLOBAL void showcountry(SLONG country);
  183. AGLOBAL void withdraw(SLONG whichhero);
  184. AGLOBAL void phase1(void);
  185. AGLOBAL void phase2(void);
  186. AGLOBAL void phase3(void);
  187. AGLOBAL void saywho(SLONG countertype, SLONG counter, FLAG comma, FLAG lowercase);
  188. AGLOBAL void place_jarls(void);
  189. AGLOBAL void print_paralyzed(SLONG paralyzed_value, SLONG index);
  190. AGLOBAL void print_location(SLONG whichcountry, SLONG index);
  191. AGLOBAL void print_sea(SLONG sea_value, SLONG index);
  192. AGLOBAL void print_hagall(SLONG hagall_value, SLONG index);
  193. AGLOBAL void print_routed(SLONG routed_value, SLONG index);
  194. AGLOBAL void promote(SLONG whichhero, SLONG whichjarl);
  195. AGLOBAL SLONG getusualmoves(SLONG countertype, SLONG whichcounter);
  196. AGLOBAL void faxi_disappear(void);
  197. AGLOBAL void pad(STRPTR thestring);
  198. AGLOBAL SLONG getstrength(SLONG countertype, SLONG counter, FLAG defending);
  199. AGLOBAL void newhero(SLONG whichhero, FLAG givesord);
  200. AGLOBAL void anykey(void);
  201. AGLOBAL void treasure_disappear(SLONG whichtreasure);
  202.  
  203. // from counters.c
  204. AGLOBAL void init_counters(void);
  205. AGLOBAL void move_hero(SLONG whichhero, FLAG display);
  206. AGLOBAL void move_jarl(SLONG whichjarl, FLAG display);
  207. AGLOBAL void move_monster(SLONG whichmonster, FLAG display);
  208. AGLOBAL void move_treasure(SLONG whichtreasure, FLAG display);
  209. AGLOBAL void move_sord(SLONG whichsord, FLAG display);
  210. AGLOBAL void createcounters(void);
  211. AGLOBAL void destroycounters(void);
  212. AGLOBAL void revealjarl(SLONG whichjarl, FLAG display);
  213. AGLOBAL void hidejarl(SLONG whichjarl, FLAG display);
  214. AGLOBAL void unslot_hero(SLONG whichhero);
  215. AGLOBAL void unslot_jarl(SLONG whichjarl);
  216. AGLOBAL void unslot_monster(SLONG whichmonster);
  217. AGLOBAL void unslot_treasure(SLONG whichtreasure);
  218. AGLOBAL void unslot_sord(SLONG whichsord);
  219. AGLOBAL SLONG checkcounters(SWORD mousex, SWORD mousey, SLONG* countertype);
  220. AGLOBAL void select_hero(SLONG whichhero, FLAG display);
  221. AGLOBAL void deselect_hero(SLONG whichhero, FLAG display);
  222. AGLOBAL void select_jarl(SLONG whichjarl, FLAG display);
  223. AGLOBAL void deselect_jarl(SLONG whichjarl, FLAG display);
  224. AGLOBAL void select_monster(SLONG whichmonster, FLAG display);
  225. AGLOBAL void deselect_monster(SLONG whichmonster, FLAG display);
  226. AGLOBAL void remove_hero(SLONG whichhero, FLAG display);
  227. AGLOBAL void remove_jarl(SLONG whichjarl, FLAG display);
  228. AGLOBAL void remove_monster(SLONG whichmonster, FLAG display);
  229. AGLOBAL void remove_treasure(SLONG whichtreasure, FLAG display);
  230. AGLOBAL void remove_sord(SLONG whichsord, FLAG display);
  231. AGLOBAL void refreshcounters(void);
  232. AGLOBAL void reset_images(void);
  233. AGLOBAL void hero_to_jarl(SLONG whichhero, SLONG whichjarl);
  234. AGLOBAL void info(SLONG countertype, SLONG counter);
  235. AGLOBAL void doc(SLONG number);
  236.  
  237. // 4. GLOBAL STRUCTURES --------------------------------------------------
  238.  
  239. AGLOBAL struct WorldStruct
  240. {   // initialized
  241.  
  242.     SLONG  centrex, centrey, tax, type;
  243.     STRPTR name;
  244.     SLONG  connection[CONNECTIONS + 1];
  245.  
  246.     // uninitialized
  247.     SLONG  hero;
  248.     FLAG   is, slot[SLOTS + 1], visited;
  249. };
  250. AGLOBAL struct RuneStruct
  251. {   STRPTR name, desc;
  252. };
  253. AGLOBAL struct HeroStruct
  254. {   // all uninitialized
  255.  
  256.     STRPTR name;
  257.     SLONG  strength, moves, glory, luck, control, sword, where, homewhere,
  258.            wealth, slot, promoted, rune, god, sea, maidens;
  259.     FLAG   alive, verydead, wounded, foundbob, moved, loseturn, hagall,
  260.            routed, attacking, defending, passenger;
  261.     SLONG  attacked[ATTACKS + 1], attacktype[ATTACKS + 1];
  262. };
  263. AGLOBAL struct JarlStruct
  264. {   // initialized
  265.     SLONG  strength,
  266.            moves;
  267.     STRPTR name;
  268.  
  269.     // uninitialized
  270.     FLAG   taken, alive, foundbob, recruitable, loseturn, hagall, routed,
  271.            attacking, defending, passenger;
  272.     SLONG  where, homewhere, wealth, face, hero, slot, sea,
  273.            attacked[ATTACKS + 1], attacktype[ATTACKS + 1];
  274. };
  275. AGLOBAL struct MonsterStruct
  276. {   // initialized
  277.     SLONG  species, strength, moves;
  278.     STRPTR name;
  279.  
  280.     // uninitialized
  281.     FLAG   taken, alive, foundbob, hagall;
  282.     SLONG  where, slot, wealth, sea;
  283. };
  284. AGLOBAL struct TreasureStruct
  285. {   // initialized
  286.     STRPTR name;
  287.     SWORD  y;
  288.  
  289.     // uninitialized
  290.     SLONG  possessor, possessortype;
  291.     FLAG   taken, foundbob;
  292.     SLONG  where, slot;
  293. };
  294. AGLOBAL struct SordStruct
  295. {   // initialized
  296.     STRPTR name;
  297.     SWORD  y;
  298.  
  299.     // uninitialized
  300.     SLONG  possessor, possessortype;
  301.     FLAG   taken, foundbob;
  302.     SLONG  where, slot;
  303. };
  304.